
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">
    <title>会员中心-{$webname}</title>
    <link rel="stylesheet" type="text/css" href="{$skin}css/member_basic.css" />
    <link rel="stylesheet" type="text/css" href="{$skin}style/member_total.css" />
    {tpl style}
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top">
    <div class="container-fluid" style="position:relative;">
        <div class="navbar-header nav_header">
            <a href="javascript:void(0);" class="navbar-brand" onclick="history.back();"><span class="glyphicon glyphicon-chevron-left icon"></span></a>
            <a href="javascript:void(0);" class="btn refresh" onclick="window.location.reload();"><span class="glyphicon glyphicon-refresh"></span></a>
        </div>
        <p style="position:absolute; top:15px; left:50%; margin-left:-30px; font-size:16px; text-shadow:2px 2px 3px #ccc;">个人资料</p>
    </div>
</nav>
<div id="main">
    <div class="container-fluid">
        <div class='replace'>

            <table class='table table_list table-striped table-hover table-bordered' cellspacing='0px' style='border-collapse:collapse;'>
                <tr>
                    <td>昵　　称 :</td>
                    <td colspan='2'><input id='txtNickName' value='{$row.nickname}' class="form-control" placeholder='6-50字符以内' /></td>
                    </tr>

                <tr>
                    <td>头　　像 :</td><td>
                    <img width='60' height='60' id='imgHead' src='{if $row.head}{$row.head}{else}img/head/1_0.jpg{/if}' />
                    <select id='sltHead'>
                        <?php
                        for($i = 0; $i <= 8; $i++ ){
                        echo  "<option value='1_$i.jpg'>男头像". ($i+1) ."</option>";
                        }
                        for($i = 0; $i <= 8; $i++ ){
                        echo  "<option value='0_$i.jpg'>女头像". ($i+1) ."</option>";
                        }
                        ?>
                    </select></td>
                    </tr>

                <tr>
                    <td>手　　机 :</td>
                    <td colspan='2'><input id='txtMobile' maxlength='11' value='{$row.mobile}' disabled='disabled' class='form-control' placeholder='11位手机号码' /></td>
                    </tr>

                <tr>
                    <td>手机状态 :</td>

                    <td colspan='2'>已绑定&nbsp;&nbsp;</td>
                    </tr>



                <tr>
                    <td>收款人名字:</td>
                    {if $row.recv_cash_name}
                    <td colspan='2'><input id='recv_cash_name' maxlength='10' name='recv_cash_name' disabled='disabled'  style='display:none' maxlength='20' value='{$row.recv_cash_name}' class='form-control'  /><input id='recv_cash_name_show' maxlength='10' name='recv_cash_name_show' disabled='disabled'  maxlength='20' value='{$row.recv_cash_name}' class='form-control' /></td>
                    {else}
                    <td colspan='2'><input id='recv_cash_name' maxlength='10' name='recv_cash_name' value='' class='form-control' placeholder='填写后不能再修改' /></td>
                    {/if}
                    </tr>

                <tr>
                    <td>QQ:</td>
                    {if $row.qq}
                    <td colspan='2'><input id='txtQQ' maxlength='20' value='{$row.qq}'   style='display:none' class='form-control' placeholder='填写后不能再修改'  /><input id='txtQQ_show' maxlength='20' value='{$row.qq}' disabled='disabled' class='form-control' placeholder='填写后不能再修改' /></td>
{else}
                    <td colspan='2'><input id='txtQQ' maxlength='20' value='{$row.qq}' class='form-control' placeholder='填写后不能再修改' /></td>
                    {/if}
                    </tr>

               

                <tr>
                    <td colspan='3'><input id='btnSubmit' type='button' class='btn btn-danger' style='margin:0 auto;' value='确定提交'></td>
                    </tr>


                </table>
            </div>
        </div>
    </div>
</div>
{tpl foot}
<script type="text/javascript">
    $(function () {


    $("#sltHead").on('change',function(){
        var pic = $(this).children('option:selected').val();
        $("#imgHead").attr("src","img/head/"+pic);
    });
    //修改资料
    $("#btnSubmit").on('click',function(){
        var nickname = $("#txtNickName").val();
        var head = $("#sltHead").val();
        var mobile = $("#txtMobile").val();
        var email = $("#txtEmail").val();
        var qq = $("#txtQQ").val();
        var caption = $("#txtCaption").val();
        var reMobile = /^1\d{10}$/;
        var reEmail = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/;
        var recv_cash_name=$("#recv_cash_name").val();
        if(nickname.length == 0)
        {
            alert("昵称不能为空!");
            return;
        }
        if(mobile != "")
        {
            if(!reMobile.test(mobile))
            {
                alert("手机号码必须1开头11位长度!");
                return;
            }
        }
        $.post("{:url('users/info')}",{act:"changedetail",nickname:nickname,head:head,mobile:mobile,email:email,qq:qq,caption:caption,recv_cash_name:recv_cash_name},function(ret){
            switch(ret.status)
            {
                case "0":
                    alert("修改成功!");
                    location.reload();
                    break;
                default:
                    alert(ret.message);
                    break;
            }
        },"json");
    });
    });
</script>
</body>
</html>